home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’93 / OK, What was that again? / Extension / Icons.h next >
Text File  |  1993-05-08  |  11KB  |  371 lines

  1.  
  2. /************************************************************
  3.  
  4. Created: Monday, July 22, 1991 at 4:45 PM
  5.  Icons.h
  6.  C Interface to the Macintosh Libraries
  7.  
  8.  
  9.   Copyright Apple Computer, Inc. 1990-1991
  10.   All rights reserved
  11.  
  12.     This file is used in these builds: BigBang
  13.  
  14.     Change History (most recent first):
  15.  
  16.          <9>     3/17/93    jg        Change how procinfos are constructed
  17.          <8>     2/26/93    EPT        Changed “Descriptor”s to “UPP”s.
  18.          <5>     12/9/92    jrc        Deal with RS6000 C++ compiler. Cast 4 byte enums with set sign
  19.                                     bits to (long).
  20.          <4>     11/4/92    EPT        Removed “RD” from field names and parameter lists.
  21.          <3>    10/13/92    jrc        Changed QuickDraw.h to Quickdraw.h for UNIX compiling.
  22.          <2>     9/28/92    stb        changed procPtrs to routine descriptors
  23.         <23>     6/11/92    DCL        Changed "Rect *textRect"
  24.                                     to "const  Rect *textRect" in RectInIconID, RectInIconSuite,
  25.                                     RectInIconMethod.
  26.                                     Changed all uses of "alignment" in prototypes to "align" for
  27.                                     consistancy within and between the c & h files.  Cleanup &
  28.                                     formatting to match Interface Stacks. Happy Happy Joy Joy.
  29.         <22>      5/5/92    DCL        Added 'const' to '*iconRect' in prototypes of The PtInIcon__,
  30.                                     RectInIcon__, Icon__ToRgn. OK, dave?
  31.         <21>     3/17/92    DC        imported all private routines and typedef's from IconUtilsPriv.h
  32.                                     and cleaned up constants to be enums.
  33.         <20>     7/23/91    JL        Checked in File from database. Changed #defines to enums.
  34.         <19>     1/17/91    DC        csd - Add genericExtensionIconResource
  35.         <18>     1/16/91    JDR        (dba) Renamed spoolFolderIconResource into
  36.                                     printMonitorFolderIconResource.
  37.         <17>      1/7/91    JDR        (dba) Removing private Icon Utilities routines.
  38.         <16>    11/29/90    DC        ngk - Add interface for GetIconDevice.
  39.         <15>    11/19/90    DC        ngk - Moved System Icon ID's from private to public and added
  40.                                     interfaces for PlotIconHandle PlotSICNHandle and PlotCIconHandle
  41.                                        interfaces for PlotIconHandle PlotSICNHandle and PlotCIconHandle
  42.         <14>     10/09/90    JAL        Changed comments from // to /* for Think C compatability.
  43.         <13>     9/19/90    DC        Changed names of some routines to be more descriptive
  44.         <12>     9/15/90    DC        Removed SetLabel from public interface
  45.         <11>      9/4/90    DC        Fixed interface to icon-to-region conversion routines
  46.         <10>     7/25/90    DC        added interface for Get/Set cache Procs/Data
  47.          <9>     7/23/90    DC        Added interfaces for SetOneScreen, etc
  48.          <8>     7/12/90    DC        Removed support for ttGhost
  49.          <7>      7/5/90    DC        Added interfaces for all hit-testing and region-producing
  50.                                     routines.
  51.          <6>     6/29/90    DC        Add labeling transforms
  52.          <5>     6/13/90    DC        changed terminateInterator to haltIterator
  53.          <4>      6/7/90    ngk        Added type definitions for IconSelectorValue, IconAlignmentType,
  54.                                     and IconTransformType
  55.          <3>     5/31/90    DC        Minor interface cleanup
  56.          <2>     5/30/90    DC        Fixed name of protection identifier from __ICONUTILS__ to
  57.                                     __ICONS__
  58.          <1>     5/30/90    DC        first checked in as Icons.h
  59.          <6>     5/22/90    DC        Made IconCaches a subclass of iconsuites.
  60.          <5>      5/4/90    DC        Added Interfaces for NewIconSuite, etc.  Added new transform
  61.                                     ttGhost
  62.          <4>     4/11/90    DC        Changed interfaces for transforms
  63.          <3>     4/10/90    DC        Made PlotIconCache and PlotIconSuite into PlotBestIcon
  64.          <2>      4/9/90    DC        Added new IconCache routines
  65.          <1>      4/7/90    DC        first checked in
  66.  
  67. ************************************************************/
  68.  
  69.  
  70. #ifndef __ICONS__
  71. #define __ICONS__
  72.  
  73. #ifndef __TYPES__
  74. #include <Types.h>
  75. #endif
  76.  
  77. #ifndef __QUICKDRAW__
  78. #include <Quickdraw.h>
  79. #endif
  80.  
  81. enum {
  82.  
  83.  
  84. /* The following are icons for which there are both icon suites and SICNs. */
  85.  genericDocumentIconResource = -4000,
  86.  genericStationeryIconResource = -3985,
  87.  genericEditionFileIconResource = -3989,
  88.  genericApplicationIconResource = -3996,
  89.  genericDeskAccessoryIconResource = -3991,
  90.  
  91.  genericFolderIconResource = -3999,
  92.  privateFolderIconResource = -3994,
  93.  
  94.  floppyIconResource = -3998,
  95.  trashIconResource = -3993,
  96.  
  97. /* The following are icons for which there are SICNs only. */
  98.  desktopIconResource = -3992,
  99.  openFolderIconResource = -3997,
  100.  genericHardDiskIconResource = -3995,
  101.  genericFileServerIconResource = -3972,
  102.  genericSuitcaseIconResource = -3970,
  103.  genericMoverObjectIconResource = -3969,
  104.  
  105. /* The following are icons for which there are icon suites only. */
  106.  genericPreferencesIconResource = -3971,
  107.  genericQueryDocumentIconResource = -16506,
  108.  genericExtensionIconResource = -16415,
  109.  
  110.  systemFolderIconResource = -3983,
  111.  appleMenuFolderIconResource = -3982
  112. };
  113. enum {
  114.  startupFolderIconResource = -3981,
  115.  ownedFolderIconResource = -3980,
  116.  dropFolderIconResource = -3979,
  117.  sharedFolderIconResource = -3978,
  118.  mountedFolderIconResource = -3977,
  119.  controlPanelFolderIconResource = -3976,
  120.  printMonitorFolderIconResource = -3975,
  121.  preferencesFolderIconResource = -3974,
  122.  extensionsFolderIconResource = -3973,
  123.  
  124.  fullTrashIconResource = -3984
  125.  
  126.  
  127. #define large1BitMask 'ICN#'
  128. #define large4BitData 'icl4'
  129. #define large8BitData 'icl8'
  130. #define small1BitMask 'ics#'
  131. #define small4BitData 'ics4'
  132. #define small8BitData 'ics8'
  133. #define mini1BitMask 'icm#'
  134. #define mini4BitData 'icm4'
  135. #define mini8BitData 'icm8'
  136. };
  137.  
  138. /*  alignment type values  */
  139.  
  140. enum {
  141. atNone = 0x0,
  142. atVerticalCenter = 0x1,
  143. atTop = 0x2,
  144. atBottom = 0x3,
  145. atHorizontalCenter = 0x4,
  146. atAbsoluteCenter = (atVerticalCenter | atHorizontalCenter),
  147. atCenterTop = (atTop | atHorizontalCenter),
  148. atCenterBottom = (atBottom | atHorizontalCenter),
  149. atLeft = 0x8,
  150. atCenterLeft = (atVerticalCenter | atLeft),
  151. atTopLeft = (atTop | atLeft),
  152. atBottomLeft = (atBottom | atLeft),
  153. atRight = 0xC,
  154. atCenterRight = (atVerticalCenter | atRight),
  155. atTopRight = (atTop | atRight),
  156. atBottomRight = (atBottom | atRight)
  157. };
  158. typedef short IconAlignmentType;
  159.  
  160.  
  161. /*  transform type values  */
  162. enum {
  163. ttNone = 0x0,
  164. ttDisabled = 0x1,
  165. ttOffline = 0x2,
  166. ttOpen = 0x3,
  167. ttLabel1 = 0x0100,
  168. ttLabel2 = 0x0200,
  169. ttLabel3 = 0x0300,
  170. ttLabel4 = 0x0400,
  171. ttLabel5 = 0x0500,
  172. ttLabel6 = 0x0600,
  173. ttLabel7 = 0x0700,
  174. ttSelected = 0x4000,
  175. ttSelectedDisabled = (ttSelected | ttDisabled),
  176. ttSelectedOffline = (ttSelected | ttOffline),
  177. ttSelectedOpen = (ttSelected | ttOpen)
  178. };
  179. typedef short IconTransformType;
  180.  
  181.  
  182. /*  Selector mask values  */
  183. enum {
  184. svLarge1Bit = 0x00000001,
  185. svLarge4Bit = 0x00000002,
  186. svLarge8Bit = 0x00000004,
  187. svSmall1Bit = 0x00000100,
  188. svSmall4Bit = 0x00000200,
  189. svSmall8Bit = 0x00000400,
  190. svMini1Bit = 0x00010000,
  191. svMini4Bit = 0x00020000,
  192. svMini8Bit = 0x00040000,
  193. svAllLargeData = 0x000000ff,
  194. svAllSmallData = 0x0000ff00,
  195. svAllMiniData = 0x00ff0000,
  196. svAll1BitData = (svLarge1Bit | svSmall1Bit | svMini1Bit),
  197. svAll4BitData = (svLarge4Bit | svSmall4Bit | svMini4Bit),
  198. svAll8BitData = (svLarge8Bit | svSmall8Bit | svMini8Bit),
  199. svAllAvailableData = (long) 0xffffffff
  200. };
  201. typedef unsigned long IconSelectorValue;    
  202.  
  203. typedef pascal OSErr (*IconAction)(ResType theType, Handle *theIcon, void *yourDataPtr);
  204. typedef pascal Handle (*IconGetter)(ResType theType, void *yourDataPtr);
  205.  
  206. #ifdef __cplusplus
  207. extern "C" {
  208. #endif
  209.  
  210. pascal OSErr PlotIconID(const Rect *theRect,
  211.                             IconAlignmentType align,
  212.                             IconTransformType transform,
  213.                             short theResID)
  214.     = {0x303C, 0x0500, 0xABC9};
  215.     
  216. pascal OSErr NewIconSuite(Handle *theIconSuite)
  217.     = {0x303C, 0x0207, 0xABC9};
  218.     
  219. pascal OSErr AddIconToSuite(Handle theIconData,
  220.                             Handle theSuite,
  221.                             ResType theType)
  222.     = {0x303C, 0x0608, 0xABC9};
  223.     
  224. pascal OSErr GetIconFromSuite(Handle *theIconData,
  225.                             Handle theSuite,
  226.                             ResType theType)
  227.     = {0x303C, 0x0609, 0xABC9};
  228.     
  229. pascal OSErr ForEachIconDo(Handle theSuite,
  230.                             IconSelectorValue selector,
  231.                             ProcPtr action,
  232.                             void *yourDataPtr)
  233.     = {0x303C, 0x080A, 0xABC9};
  234.     
  235. pascal OSErr GetIconSuite(Handle *theIconSuite,
  236.                             short theResID,
  237.                             IconSelectorValue selector)
  238.     = {0x303C, 0x0501, 0xABC9};
  239.     
  240. pascal OSErr DisposeIconSuite(Handle theIconSuite,
  241.                             Boolean disposeData)
  242.     = {0x303C, 0x0302, 0xABC9};
  243.     
  244. pascal OSErr PlotIconSuite(const Rect *theRect,
  245.                             IconAlignmentType align,
  246.                             IconTransformType transform,
  247.                             Handle theIconSuite)
  248.     = {0x303C, 0x0603, 0xABC9};
  249.     
  250. pascal OSErr MakeIconCache(Handle *theHandle,
  251.                             ProcPtr makeIcon,
  252.                             void *yourDataPtr)
  253.     = {0x303C, 0x0604, 0xABC9};
  254.     
  255. pascal OSErr LoadIconCache(const Rect *theRect,
  256.                             IconAlignmentType align,
  257.                             IconTransformType transform,
  258.                             Handle theIconCache)
  259.     = {0x303C, 0x0606, 0xABC9};
  260.  
  261. pascal OSErr PlotIconMethod(const Rect *theRect,
  262.                             IconAlignmentType align,
  263.                             IconTransformType transform,
  264.                             ProcPtr theMethod,
  265.                             void *yourDataPtr)
  266.     = {0x303C, 0x0805, 0xABC9};
  267.     
  268. pascal OSErr GetLabel(short labelNumber,
  269.                             RGBColor *labelColor,
  270.                             Str255 labelString)
  271.     = {0x303C, 0x050B, 0xABC9};
  272.     
  273. pascal Boolean PtInIconID(Point testPt,
  274.                             const Rect *iconRect,                /* <22> */
  275.                             IconAlignmentType align,
  276.                             short iconID)
  277.     = {0x303C, 0x060D, 0xABC9};
  278.     
  279. pascal Boolean PtInIconSuite(Point testPt,
  280.                             const Rect *iconRect,                /* <22> */
  281.                             IconAlignmentType align,
  282.                             Handle theIconSuite)
  283.     = {0x303C, 0x070E, 0xABC9};
  284.     
  285. pascal Boolean PtInIconMethod(Point testPt,
  286.                             const Rect *iconRect,                /* <22> */
  287.                             IconAlignmentType align,
  288.                             ProcPtr theMethod,
  289.                             void *yourDataPtr)
  290.     = {0x303C, 0x090F, 0xABC9};
  291.     
  292. pascal Boolean RectInIconID(const Rect *testRect,
  293.                             const Rect *iconRect,                /* <22> */
  294.                             IconAlignmentType align,
  295.                             short iconID)
  296.     = {0x303C, 0x0610, 0xABC9};
  297.     
  298. pascal Boolean RectInIconSuite(const Rect *testRect,
  299.                             const Rect *iconRect,                /* <22> */
  300.                             IconAlignmentType align,
  301.                             Handle theIconSuite)
  302.     = {0x303C, 0x0711, 0xABC9};
  303.     
  304. pascal Boolean RectInIconMethod(const Rect *testRect,
  305.                             const Rect *iconRect,                /* <22> */
  306.                             IconAlignmentType align,
  307.                             ProcPtr theMethod,
  308.                             void *yourDataPtr)
  309.     = {0x303C, 0x0912, 0xABC9};
  310.     
  311. pascal OSErr IconIDToRgn(RgnHandle theRgn,
  312.                             const Rect *iconRect,                /* <22> */
  313.                             IconAlignmentType align,
  314.                             short iconID)
  315.     = {0x303C, 0x0613, 0xABC9};
  316.     
  317. pascal OSErr IconSuiteToRgn(RgnHandle theRgn,
  318.                             const Rect *iconRect,                /* <22> */
  319.                             IconAlignmentType align,
  320.                             Handle theIconSuite)
  321.     = {0x303C, 0x0714, 0xABC9};
  322.     
  323. pascal OSErr IconMethodToRgn(RgnHandle theRgn,
  324.                             const Rect *iconRect,                /* <22> */
  325.                             IconAlignmentType align,
  326.                             ProcPtr theMethod,
  327.                             void *yourDataPtr)
  328.     = {0x303C, 0x0915, 0xABC9};
  329.     
  330. pascal OSErr SetSuiteLabel(Handle theSuite, short theLabel)
  331.     = {0x303C, 0x0316, 0xABC9};
  332.  
  333. pascal short GetSuiteLabel(Handle theSuite)
  334.     = {0x303C, 0x0217, 0xABC9};
  335.  
  336. pascal OSErr GetIconCacheData(Handle theCache, void **theData)
  337.     = {0x303C, 0x0419, 0xABC9};
  338.         
  339. pascal OSErr SetIconCacheData(Handle theCache, void *theData)
  340.     = {0x303C, 0x041A, 0xABC9};
  341.         
  342. pascal OSErr GetIconCacheProc(Handle theCache, ProcPtr *theProc)
  343.     = {0x303C, 0x041B, 0xABC9};
  344.         
  345. pascal OSErr SetIconCacheProc(Handle theCache, ProcPtr theProc)
  346.     = {0x303C, 0x041C, 0xABC9};
  347.     
  348. pascal OSErr PlotIconHandle(const Rect *theRect,
  349.                             IconAlignmentType align,
  350.                             IconTransformType transform,
  351.                             Handle theIcon)
  352.     = {0x303C, 0x061D, 0xABC9};
  353.     
  354. pascal OSErr PlotSICNHandle(const Rect *theRect,
  355.                             IconAlignmentType align,
  356.                             IconTransformType transform,
  357.                             Handle theSICN)
  358.     = {0x303C, 0x061E, 0xABC9};
  359.     
  360. pascal OSErr PlotCIconHandle(const Rect *theRect,
  361.                             IconAlignmentType align,
  362.                             IconTransformType transform,
  363.                             CIconHandle theCIcon)
  364.     = {0x303C, 0x061F, 0xABC9};
  365.     
  366. #ifdef __cplusplus
  367. }
  368. #endif
  369.  
  370. #endif
  371.